home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 April / Software of the Month Club 1996 April.iso / pc / os2 / psutils / src / fixtpps.pl < prev    next >
Text File  |  1996-02-21  |  635b  |  29 lines

  1. @PERL@
  2. # fixtpps: fix tpscript document to work with PSUtils
  3. #
  4. # Copyright (C) Angus J. C. Duggan 1991-1995
  5. # See file LICENSE for details.
  6.  
  7. $nesting = 0;
  8. $header = 1;
  9.  
  10. while (<>) {
  11.    if (/^%%Page:/ && $nesting == 0) {
  12.       print $_;
  13.       print "save home\n";
  14.       $header = 0;
  15.    } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) {
  16.       print $_;
  17.       $nesting++;
  18.    } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) {
  19.       print $_;
  20.       $nesting--;
  21.    } elsif (/save home/) {
  22.       s/save home//;
  23.       print $_;
  24.    } elsif (!$header || (! /^save$/ && ! /^home$/)) {
  25.       print $_;
  26.    }
  27. }
  28. @END@
  29.